#include "Fifo.h"

Fifo::Fifo(const std::string name) : name(name), fd(-1) {}

Fifo::~Fifo() {
}

void Fifo::create_(){
	if ( mknod ( static_cast<const char*>(name.c_str()),S_IFIFO|0666, 0 ) < 0){
		throw Exception(std::string("Error al crear fifo"));
	}
}

void Fifo::close_() {
	close ( fd );
	fd = -1;
}

void Fifo::delete_() const {
	if ( unlink ( name.c_str() ) != 0 ){
		throw Exception(std::string("Error al eliminar fifo"));
	}
}
